package com.sentrix.auto.printercenter.presentation.api;

import com.sentrix.auto.printercenter.presentation.api.dto.EasyPrintReqDto;
import com.sentrix.auto.printercenter.presentation.api.dto.PrintReqDto;
import com.sentrix.auto.printercenter.application.PrinterService;
import com.sentrix.auto.printercenter.presentation.api.dto.ScanPrintReqDto;
import com.sentrix.auto.printercenter.presentation.common.DataResponse;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Slf4j
@RestController
@RequestMapping("api/printer")
public class PrinterApiController {


    @Autowired
    private PrinterService printService;

    /**
     * 扫码打印
     * @param scanPrintReqDto
     * @return
     */
    @PostMapping("scan-print")
    public DataResponse print(@Validated @RequestBody ScanPrintReqDto scanPrintReqDto) {
        printService.scanPrint(scanPrintReqDto);
        return new DataResponse("1", true, 200, "打印成功");
    }
}
